# 输入要检查的网段，子网掩码（输入：192.168.0.0/24)
# import subprocess
# import IPy
# ip=input("请输入要查询的ip网段：")
# try:
#     ips=IPy.IP(ip)
#     print(len(ips))
#     for i in ips:
#         p=subprocess.getoutput(f"ping -n 1 -w 1 {i}")
#         if "请求超时" in p:
#             continue
#         else:
#             ip_useds=str(i)+"该ip已被使用"
#             with open ("ips_used.txt","a+",encoding="utf-8") as f:
#                 f.write(ip_useds+"\n")
#                 f.flush()
#     print("判断结束")
# except ValueError as e:
#     print("输入有误")
